<!DOCTYPE html>
<head>
    <#assign dicSelect = JspTaglibs["http://www.casic304.cn/dicSelect"]/>
    <#assign secSelect = JspTaglibs["http://www.casic304.cn/secSelect"] />
    <#assign fillDept=JspTaglibs["http://www.casic304.cn/fillDept"] />
    <meta charset="utf-8">
    <title>飞行试验管理基本信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${ctx}/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/iconfont/iconfont.css"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/style/qbdms.css">
    <script type="text/javascript">
        var __ctx = "${ctx}";
    </script>
</head>
<body class="listBody">
<div class="qbdms-bodyDiv">
    <div class="layui-table-view-body qbdms-add-view-body">
        <form class="formPreview layui-form" requrl="${ctx}/qbdms/wQbdFlightTest/get" lay-filter="wQbdFlightTestDataForm">
            <div class="qbdms-formTitle">飞行试验信息 <i class="qbdms-returnOn closeWindow">返回</i></div>
            <div class="qbdms-formBody">
                <@fillDept.dept id="tbxx"/>
                <div class="layui-row">
                    <div class="qbdms-oneForm">
                        <label class="layui-form-label qbdms-label" title="试验名称">试验名称<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" placeholder="请输入" autocomplete="off" class="layui-input" lay-verify="required" name="fTestname" lay-reqtext="试验名称是必填项" maxlength="100">
                        </div>
                    </div>
                    <div class="qbdms-oneForm">
                        <label class="layui-form-label qbdms-label" title="密级">密级<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <@secSelect.sec_select data_src=1 required=true name="secret"/>
                        </div>
                    </div>
                    <div class="qbdms-oneForm">
                        <label class="layui-form-label qbdms-label" title="进场标识">进场标识<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" placeholder="请输入" autocomplete="off" class="layui-input textInput" lay-verify="required" lay-reqtext="进场标识是必填项" name="fEntrysign" maxlength="50">
                        </div>
                    </div>
                    <div class="qbdms-oneForm">
                        <label class="layui-form-label qbdms-label" title="入档编号">入档编号<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" placeholder="请输入" autocomplete="off" class="layui-input textInput" name="fFilingnumber" maxlength="50" lay-verify="required" lay-reqtext="入档编号是必填项">
                        </div>
                    </div>
                    <div class="qbdms-oneForm">
                        <label class="layui-form-label qbdms-label" title="型号代号">型号代号<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <select id="fModelsymbol" name="fModelsymbol" class="layui-input filter-value" lay-search="" lay-verify="required" lay-reqtext="型号代号是必填项" lay-filter="xh" maxlength="50"></select>
                        </div>
                    </div>
                    <div class="qbdms-oneForm">
                        <label class="layui-form-label qbdms-label" title="型号名称">型号名称<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" placeholder="根据型号代号自动填写" autocomplete="off" class="layui-input textInput isReadonlyInput" name="fModelnmae" maxlength="100" lay-verify="required" lay-reqtext="型号名称是必填项" disabled>
                        </div>
                    </div>
                    <div class="qbdms-oneForm">
                        <label class="layui-form-label qbdms-label" title="型号类型">型号类型<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <@dicSelect.dic name="fModeltype" nodeKey="xhlx" verify="required" reqtext="型号类型是必填项" />
                        </div>
                    </div>
                    <div class="qbdms-oneForm">
                        <label class="layui-form-label qbdms-label" title="型号批次">型号批次</label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" placeholder="请输入" autocomplete="off" class="layui-input textInput" name="fModelbatchno" maxlength="50">
                        </div>
                    </div>
                    <div class="qbdms-oneForm">
                        <label class="layui-form-label qbdms-label" title="型号研制阶段">型号研制阶段<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <@dicSelect.dic name="fModeldevelopphase" nodeKey="xhyzjd" verify="required" reqtext="型号研制阶段是必填项" />
                        </div>
                    </div>
                    <div class="qbdms-oneForm">
                        <label class="layui-form-label qbdms-label" title="技术状态">技术状态</label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" placeholder="请输入" autocomplete="off" class="layui-input textInput" name="fTechnicalstatus" maxlength="100">
                        </div>
                    </div>
                    <div class="qbdms-oneForm">
                        <label class="layui-form-label qbdms-label" title="总装单位">总装单位<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" placeholder="请输入" autocomplete="off" class="layui-input textInput" name="fGeneralunit" maxlength="100" lay-verify="required" lay-reqtext="总装单位是必填项">
                        </div>
                    </div>
                    <div class="qbdms-oneForm">
                        <label class="layui-form-label qbdms-label" title="总体单位">总体单位<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" placeholder="请输入" autocomplete="off" class="layui-input textInput" name="fPopulationunit" maxlength="100" lay-verify="required" lay-reqtext="总体单位是必填项">
                        </div>
                    </div>
                    <div class="qbdms-oneForm">
                        <label class="layui-form-label qbdms-label" title="试验性质">试验性质<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <@dicSelect.dic name="fTestphase" nodeKey="syxz" verify="required" reqtext="试验性质是必填项" />
                        </div>
                    </div>
                    <div class="qbdms-oneForm">
                        <label class="layui-form-label qbdms-label" title="试验代号">试验代号</label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" placeholder="请输入" autocomplete="off" class="layui-input textInput" name="fTestcode" maxlength="50">
                        </div>
                    </div>
                    <div class="qbdms-oneForm">
                        <label class="layui-form-label qbdms-label" title="试验地点">试验地点</label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" placeholder="请输入" autocomplete="off" class="layui-input textInput" name="fTestplace" maxlength="100">
                        </div>
                    </div>
                    <div class="qbdms-oneForm">
                        <label class="layui-form-label qbdms-label" title="试验日期">试验日期<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" placeholder="请输入" autocomplete="off" class="layui-input dateTimeFiled input-right time-init" id="fTestdate" name="fTestdate" format="yyyy-MM-dd" datetype="date" lay-verify="required" lay-reqtext="试验日期是必填项" readonly>
                        </div>
                    </div>
                    <div class="qbdms-oneForm">
                        <label class="layui-form-label qbdms-label" title="导弹编号">导弹编号<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" placeholder="请输入" autocomplete="off" class="layui-input textInput" name="fMissilenumber" maxlength="50" lay-verify="required" lay-reqtext="导弹编号是必填项">
                        </div>
                    </div>
                    <div class="qbdms-oneForm">
                        <label class="layui-form-label qbdms-label" title="发射日期">发射日期<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" placeholder="请输入" autocomplete="off" class="layui-input dateTimeFiled input-right time-init" id="fLaunchdate" name="fLaunchdate" format="yyyy-MM-dd" datetype="date" lay-verify="required" lay-reqtext="发射日期是必填项" maxlength="50" readonly>
                        </div>
                    </div>
                    <div class="qbdms-oneForm">
                        <label class="layui-form-label qbdms-label" title="发射情况">发射情况<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <@dicSelect.dic name="fLaunchstatus" nodeKey="fsqk" verify="required" reqtext="发射情况是必填项" />
                        </div>
                    </div>
                    <div class="qbdms-oneForm">
                        <label class="layui-form-label qbdms-label" title="飞行试验问题数">飞行试验问题数<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" placeholder="请输入" autocomplete="off" class="layui-input textInput" name="fFlighttestproblems" maxlength="50" lay-verify="required|integer" lay-reqtext="飞行试验问题数是必填项">
                        </div>
                    </div>
                    <div class="qbdms-textarea">
                        <label class="layui-form-label qbdms-label" title="试验情况">试验情况</label>
                        <div class="layui-input-block qbdms-input">
                            <textarea rows="2" class="layui-textarea" placeholder="请输入" name="fTeststatus" maxlength="1000"></textarea>
                        </div>
                    </div>
                    <div class="qbdms-oneForm">
                        <label class="layui-form-label qbdms-label" title="飞行结果">飞行结果<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <@dicSelect.dic name="fFlightresult" nodeKey="fxjg" verify="required" reqtext="飞行结果是必填项" />
                        </div>
                    </div>
                    <div class="qbdms-textarea">
                        <label class="layui-form-label qbdms-label" title="剔除依据">剔除依据</label>
                        <div class="layui-input-block qbdms-input">
                            <textarea rows="2" class="layui-textarea" placeholder="请输入" name="fExclusionbasis" maxlength="1000"></textarea>
                        </div>
                    </div>
                    <div class="qbdms-textarea">
                        <label class="layui-form-label qbdms-label" title="失利原因">失利原因</label>
                        <div class="layui-input-block qbdms-input">
                            <textarea rows="2" class="layui-textarea" placeholder="请输入" name="fFailurereason" maxlength="1000"></textarea>
                        </div>
                    </div>
                    <div class="qbdms-oneForm">
                        <label class="layui-form-label qbdms-label" title="是否进行奖励">是否进行奖励</label>
                        <div class="layui-input-block qbdms-input">
                            <@dicSelect.dic id="fAward" name="fAward" nodeKey="sf" filter="jaingli" search=true/>
                        </div>
                    </div>
                    <div class="qbdms-oneForm jiangli">
                        <label class="layui-form-label qbdms-label" title="类别">类别<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" placeholder="请输入" autocomplete="off" class="layui-input textInput" name="fType" maxlength="25" lay-verify="required" lay-reqtext="类别是必填项">
                        </div>
                    </div>
                    <div class="qbdms-oneForm jiangli">
                        <label class="layui-form-label qbdms-label" title="总金额">总金额</label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" placeholder="自动计算" autocomplete="off" class="layui-input textInput isReadonlyInput" name="fTotalmoney" maxlength="50" readonly>
                        </div>
                    </div>
                    <div class="qbdms-oneForm jiangli2">
                        <label class="layui-form-label qbdms-label" title="认定情况">认定情况<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" placeholder="请输入" autocomplete="off" class="layui-input textInput" name="fIdentification" maxlength="500" lay-verify="required" lay-reqtext="认定情况是必填项">
                        </div>
                    </div>
                    <div class="qbdms-textarea awardreason">
                        <label class="layui-form-label qbdms-label">奖励原因</label>
                        <div class="layui-input-block qbdms-input">
                            <textarea rows="2" class="layui-textarea" placeholder="请输入" name="fAwardreason" maxlength="100"></textarea>
                        </div>
                    </div>
                </div>
            </div>
            <p class="qbdms-SubTableTitle"><span>奖励情况表</span></p>
            <div class="qbdms-tableDiv">
                <a modetype="2" class="addFormTr1" id="add"><i class="layui-icon layui-icon-addition"></i>新增</a>
                <table class="qbdms-temTable wQbdFlighttestChildren subFormTable" id="wQbdFlighttestChildren" style="min-width: 806px;">
                    <tbody>
                    <tr class="temSpace qbdms-temTable-thead">
                        <td class="temSpace" style="width: 30px;">序号</td>
                        <td class="temSpace subDialogShowState" style="width: 170px">单位名称<span style="color: red;">*</span></td>
                        <td class="temSpace subDialogShowState" style="width: 90px">奖励总人数<span style="color: red;">*</span></td>
                        <td class="temSpace subDialogShowState" style="width: 90px">金额(元)<span style="color: red;">*</span></td>
                        <td class="temSpace subDialogShowState">详细情况<span style="color: red;">*</span></td>
                        <td class="temSpace qbdms-subOptState">管理</td>
                    </tr>
                    <tr class="temSpace subContTem">
                        <td class="temSpace qbdms-temTable-seNumber">
                            <div class="temTag">0</div>
                        </td>
                        <td class="temSpace qbdms-temTable-td">
                            <input type="text" placeholder="请输入" requiredFlag="required" autocomplete="off" class="layui-input textInput" maxlength="50" name="s:wQbdFlighttestChildren:companyName" lay-reqtext="单位名称是必填项">
                        </td>
                        <td class="temSpace qbdms-temTable-td">
                            <input type="text" title="请输入奖励总人数" requiredFlag="required|integer" autocomplete="off" class="layui-input" name="s:wQbdFlighttestChildren:totalNumberOfAwards" maxlength="10" lay-reqtext="奖励总人数是必填项">
                        </td>
                        <td class="temSpace qbdms-temTable-td qbdms-money">
                            <input type="text" title="请输入金额" requiredFlag="required|money" autocomplete="off" class="layui-input" name="s:wQbdFlighttestChildren:sumOfMoney" maxlength="10" lay-reqtext="金额是必填项">
                        </td>
                        <td class="temSpace qbdms-temTable-td">
                            <input type="text" title="请输入详细情况" requiredFlag="required" autocomplete="off" class="layui-input" name="s:wQbdFlighttestChildren:details" maxlength="50" lay-reqtext="详细情况是必填项">
                        </td>
                        <td class="temSpace qbdms-subOptState">
                            <a class="subDeleteTr RightBtn">删除</a>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <div class="layui-hide">
                <input type="text" name="id" placeholder="请输入" autocomplete="off" class="layui-input " maxlength="50">
            </div>
            <div class="layui-form-item btnformItem">
                <p>
                    <span id="hideAndShow" style="display: none;">
                        <a lay-submit lay-filter="wQbdFlightTest" class="layui-btn btn-n privateSubmit qbdms-oneBtn" requrl="${ctx}/qbdms/wQbdFlightTest/save">提交</a>
                    </span>
                    <button type="reset" id="closeWindow" style="margin-left: 10px;" class="layui-btn layui-btn-sm btn-save qbdms-oneBtnLine">取消</button>
                </p>
            </div>
        </form>
    </div>
</div>
<script src="${ctx}/qbdmsStatic/public/configFile.js"></script>
<script src="${ctx}/layui/layui.js"></script>

<script>

    layui.config({
        base: serverPath.qbdmsPath + staticPath.qbdmsPath //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'setter', 'layer', 'propsHandle', 'upload', 'common', 'laydate', 'jquery', 'publicMethods', 'qbdmsForm'], function () {

        // -----常量声明----------
        var $ = layui.jquery,
            laydate = layui.laydate,
            setter = layui.setter,  // 配置信息
            layer = layui.layer,
            common = layui.common,
            propsHandle = layui.propsHandle,
            upload = layui.upload,
            publicMethods = layui.publicMethods,
            formId = '${formDefId}' || '',
            defProps = {
                //viewMould: 'form/formDef/view/formDesign/moulds/', // 组件模块 存放文件 *****
                viewMould: 'moulds/', // 组件模块 存放文件 *****
                formAreaInfo: '.formPreview',
                formAreaInfo: 'html',
                temDate: '.temDate',
                uploadFileBtn: '.uploadFileBtn',
                uploadImgBtn: '.uploadImgBtn',
                richTextArea: '.richTextArea',
                selectInput: '.selectInput',
                radioOptionCont: '.radioOptionCont',
                dataLexiTree: '.dataLexiTree',
                selectorBtn: '.selectorBtn'
            },
            temQuery = new propsHandle(),  // 实例化模板功能部分
            form = layui.qbdmsForm;
        // 初始化模板功能
        temQuery.initTem({
            selectorBtn: defProps.selectorBtn,
            selectorTemPath: setter.views + defProps.viewMould
        });
        $(".subContTem").hide()
        // 子表初始化事件
        temQuery.initSubEvent(defProps, serverPath, setter);

        var dateTimeFiledLen = $(".dateTimeFiled");
        for (var i = 0; i < dateTimeFiledLen.length; i++) {
            laydate.render({
                elem: dateTimeFiledLen[i] //指定元素
                , type: 'date'
                , trigger: 'click'
            });
        }

        var count = 1;
        $(document).on('click', '.addFormTr1', function () {
            count += 1;
            var modetype = $(this).attr('modetype'),
                copyObj = $(this).parent().children('.subFormTable'),
                copyHtm = copyObj.find('tr').eq(1);
            if (modetype === '2') {
                //在这里做一个转换，控制子表隐藏行的必填
                var copyHtmlStr = copyHtm.html();
                copyHtmlStr = copyHtmlStr.replace(/requiredflag/g, "lay-verify");
                // 表格
                copyObj.append('<tr class="temSpace">' + copyHtmlStr + '</tr>');
                // copyObj.append('<tr class="temSpace">' + copyHtm.html() + '</tr>');
                var trArr = copyObj.find('tr');
                trArr.eq(trArr.length - 1).find('td').eq(0).find('.temTag').html(trArr.length - 2);
                // trArr.eq(trArr.length - 1).find('td').eq(6).find('button').attr("id","fSkillcerfileList"+count);
                trArr.eq(trArr.length - 1).find('.fileUpload').attr("id", "fSkillcerfileList" + count);

                trArr.eq(trArr.length - 1).find('[isinit="1"]').each(function (i, item) {
                    $(item).attr('isinit', '2');
                });
                if (trArr.length > 3) {
                    trArr.eq(trArr.length - 1).find('[type=radio]').each(function (i, item) {
                        $(item).attr('name', (trArr.eq(1).find('[type=radio]').eq(i).attr('name')) + '_' + (trArr.length - 2))
                    });
                }
                temQuery.initTemEvent(defProps, serverPath, setter);
            } else if (modetype === '1') {
                // updateTr(copyObj, copyHtm);
            }
            form.render();
            publicMethods.bottomFixd()
        });

        //- 添加表单验证规则 开始 ---------------------------------------------------------------------
        form.verify({
            integer:function (value,item) {
                if (value && !new RegExp(/^(0|[1-9]\d*)$/).test(value)) {
                    return common.verifyTitleAdd(item) +"请输入非负整数";
                }
            },
            money: function (value,item) {
                if (value && !new RegExp(/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/).test(value)) {
                    return common.verifyTitleAdd(item) +'请输入数字且小数最多两位';
                }
            }
        });
        //- 添加表单验证规则 结束 ---------------------------------------------------------------------

        //- 是否进行奖励相关 开始 -------------------------------------------------------------
        // 首先,是否进行奖励不是必填项,其次,新增时默认隐藏类别/认定情况和子表,并去除其必填校验(类别有值"奖励",只是隐藏了而已)
        $(".jiangli").hide();
        $(".jiangli2").hide();
        $(".awardreason").hide();
        $(".qbdms-SubTableTitle").hide();
        $(".qbdms-tableDiv").hide();
        $("input[name='fType']").val("奖励");
        $("input[name='fType']").removeAttr("lay-verify");
        $("input[name='fIdentification']").removeAttr("lay-verify");
        form.on('select(jaingli)', initAwardDiv);
        $("input[name='fTotalmoney']").val("0");

        function initAwardDiv(award) {
            var val = award.value ? award.value : award;
            var validArr = ["fType", "fIdentification"];
            if (val == "是") {
                $(".jiangli").show();
                $(".jiangli2").show();
                $(".awardreason").show();
                $(".qbdms-SubTableTitle").show();
                $(".qbdms-tableDiv").show();
                common.setComponentRequired(validArr, true);
            } else {
                $("input[name='fTotalmoney']").val("0");
                $(".jiangli").hide();
                $(".jiangli2").hide();
                $(".awardreason").hide();
                $(".qbdms-SubTableTitle").hide();
                $(".qbdms-tableDiv").hide();
                common.setComponentRequired(validArr, false);
                common.clearComponentVal(validArr);
                // 删除子表数据条目
                $(".subDeleteTr").each(function () {
                    if ($(this).parents(".subContTem").length == 0) {
                        $(this).trigger("click");
                    }
                });
            }
            form.render();
        }

        //- 是否进行奖励相关 结束 -------------------------------------------------------------

        form.on('select(xh)', function (data) {
            $("input[name='fModelnmae']").val(data.elem[data.elem.selectedIndex].getAttribute("xhmc"));
        });

        //- 发射时间和试验时间校验 开始 ---------------------------------------------------------------------
        var start = laydate.render({
            elem: '#fTestdate',
            type: 'date',
            format: 'yyyy-MM-dd',
            trigger: 'click',
            btns: ['clear', 'confirm'],
            done: function (value, date, endDate) {
                endMax = end.config.max;
                end.config.min = date; //最大时间为结束时间的开始值  
                end.config.min.month = date.month - 1;
                $("input[name='fTestdate']").val(value);
            }
        });
        var end = laydate.render({
            elem: '#fLaunchdate',
            type: 'date',
            format: 'yyyy-MM-dd',
            trigger: 'click',
            btns: ['clear', 'confirm'],
            done: function (value, date) {
                if ($.trim(value) == '') {
                    var curDate = new Date();
                    date = {
                        'date': curDate.getDate(),
                        'month': curDate.getMonth() + 1,
                        'year': curDate.getFullYear()
                    };
                }
                start.config.max = date; //最小时间为开始时间的最大值  
                start.config.max.month = date.month - 1;
                $("input[name='fLaunchdate']").val(value);
            }
        })
        //- 发射时间和试验时间校验 结束 ---------------------------------------------------------------------

        //关闭当前页面
        $("#closeWindow,.closeWindow").click(function () {
            window.location.href = serverPath.qbdmsPath + '/qbdms/wQbdFlightTest/view/list';
        });

        var runId = "${runId}";
        if (runId == null || runId == '') {
            $("#hideAndShow").show();
        }

        var index = parent.layer.getFrameIndex(window.name);
        common.updateForm({
            name: 'wQbdFlightTestDataForm',
            idValue: "${id}",
            primary: "id",
            beforeSubmitFun: function (data) {
                //- 子表数据 开始 ------------------------------------------------------
                var sub = [];
                $('table.subFormTable').each(function () {
                    var table = {
                        tableName: $(this).attr('class').split(" ")[1],
                        fields: []
                    };
                    $(this).find('tr.temSpace').each(function (i, item) {    /*修复需要提交隐藏的行数据的bug*/
                        if (i > 1) {
                            var row = {};
                            var objRow = $(this);
                            $("input:text[name^='s:'],input[type='hidden'][name^='s:'],textarea[name^='s:'],select[name^='s:'],ul[name^='m:']", objRow).each(function () {
                                var name = $(this).attr('name').replace(/.*:/, '');
                                row[name] = $(this).val();
                            });
                            row["sort"] = i - 1;
                            table.fields.push(row);
                        }
                    });
                    data.field[table.tableName] = table.fields;
                });
                //- 子表数据 结束 ------------------------------------------------------
            },
            getCallback: function (data) {
                $("#tbxx").html("<span class='qbdms-TBinformation'>填报信息:</span><span class='qbdms-TBinformationText'>【" + data.data.filldept + " | " + data.data.fillman + " | " + data.data.filldate + "】</span>");
                $('table.subFormTable').each(function () {
                    var table = {
                        tableName: $(this).attr('class').split(" ")[1],
                        fields: []
                    };
                    table.fields = data.data[table.tableName];
                    for (var i = 0, len = table.fields.length; i < len; i++) {
                        var dataRow = table.fields[i];
                        var temp = $("." + table.tableName).prev().click();
                        //这里有子表表头占一行，子表隐藏行占一行，所以取需要赋值的行时，需要temp=i+2
                        var domRow = $(this).find("tr.temSpace:eq(" + (i * 1 + 2) + ")");
                        $.each(dataRow, function (j, val) {
                            var domItem = domRow.find("[name$='" + j + "']");
                            if (domItem) {
                                domItem.val(val);
                            }
                        });
                    }
                });
                var fAward = data.data["fAward"];
                initAwardDiv(fAward);
            },
            updateCallback: function (data) {
                if (publicMethods._filterRecord(data)) {
                    if ($(".privateSubmit")) {
                        $(".privateSubmit").attr("disabled", false).css("pointer-events", "auto");
                    }
                    layer.alert(publicMethods.confirmStyle(data.msg), {title: false, skin: 'confirm-class'}, function (index) {
                        layer.close(index);
                        window.location.href = serverPath.qbdmsPath + '/qbdms/wQbdFlightTest/view/list';
                    });
                } else {
                    layer.alert(publicMethods.confirmStyle(data.msg), {title: false, skin: 'confirm-class'});
                }
                return false;
            }

        });

        //- 计算总金额 绑事件 开始 -------------------------------------------------------------
        $(document).on("blur", "[name='s:wQbdFlighttestChildren:sumOfMoney']", computeMoney);
        $(document).on("click", ".subDeleteTr", computeMoney);

        function computeMoney() {
            if ($(this).text() == "删除") {
                $(this).parent().parent().find("[name='s:wQbdFlighttestChildren:sumOfMoney']").val(0);
            }
            var objArr = $("[name='s:wQbdFlighttestChildren:sumOfMoney']");
            var sumMoney = 0;
            objArr.each(function () {
                var money = $(this).val();
                if (isNaN(money * 1)) {
                    return;
                }
                sumMoney += 1 * (money == "" ? 0 : money);
            });
            $("[name='fTotalmoney']").val(Math.round(sumMoney * 100) / 100);
        }

        //- 计算总金额 绑事件 结束 -------------------------------------------------------------

        // 型号代号
        var xhdh = eval('${wQbdXhdhs}'); //型号代号
        var initXHDH = function (optionObj, item) {
            optionObj.text = item.fModelcode;
            optionObj.value = item.fModelcode;
            optionObj.setAttribute("xhmc", item.fModelname);
        };
        common.initDicData("fModelsymbol", xhdh, "", initXHDH);

        publicMethods.bottomFixd()
        form.on('select', function (data) {
            publicMethods.bottomFixd()
        });
        form.render();
    });
</script>
</body>
</html>